aggregate form elements into object ? [Solved]

Posted by Mahmoud on Stack Overflow See other posts from Stack Overflow or by Mahmoud
Published on 2010-06-05T22:45:40Z Indexed on 2010/06/07 11:32 UTC
Read the original article Hit count: 217

hey all

i am trying to aggregate form elements into object and then send it via ajax here is the code that i start using but i cant figure out how to do the rest

$('.jcart').live('submit', function() {

});

Update 1:

html form

http://pasite.org/code/572

Update 2:

I have successfully submit the form using ajax but it still refreshes the page after submiting

this what i did

function adding(form){
$( "form.jcart" ).livequery('submit', function() {var b=$(this).find('input[name=<?php echo $jcart['item_id']?>]').val();var c=$(this).find('input[name=<?php echo $jcart['item_price']?>]').val();var d=$(this).find('input[name=<?php echo $jcart['item_name']?>]').val();var e=$(this).find('input[name=<?php echo $jcart['item_qty']?>]').val();var f=$(this).find('input[name=<?php echo $jcart['item_add']?>]').val();$.post('<?php echo $jcart['path'];?>jcart-relay.php',{"<?php echo $jcart['item_id']?>":b,"<?php echo $jcart['item_price']?>":c,"<?php echo $jcart['item_name']?>":d,"<?php echo $jcart['item_qty']?>":e,"<?php echo $jcart['item_add']?>":f}                                            
});
 return false;                                                  
}

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX